package com.chencs.app.model.controller;

import com.chencs.app.model.service.AppModelService;
import com.chencs.vo.net.request.RequestBase;
import framework.model.ResponseOptUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


/**
 * Created by Administrator on 2017/10/10.
 */

@RestController
@RequestMapping("/app/index")
public class AppModelController {

    @Autowired
    private AppModelService appModelService;

    /**
     * 获取首页轮播广告
     * @return
     */
    @RequestMapping(value = "/slideAdver", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String slideAdver(@RequestBody RequestBase request){
        String retStr = "";
        try {
            retStr = appModelService.slideAdver(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }


    /**
     * 导购模块
     * @return
     */
    @RequestMapping(value = "/guide", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String guide(@RequestBody RequestBase request){
        String retStr = "";
        try {
            retStr = appModelService.guide(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }

    /**
     * 导购模块2
     * @return
     */
    @RequestMapping(value = "/guideImage", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String guideImage(@RequestBody RequestBase request){
        String retStr = "";
        try {
            retStr = appModelService.guideImage(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }

    /**
     * 获取欢迎界面广告图
     * @return
     */
    @RequestMapping(value = "/getWelcomeAd", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getWelcomeAd(@RequestBody RequestBase request){
        String retStr = "";
        try {
            retStr = appModelService.getWelcomeAd(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }

    /**
     * 获取弹窗广告AD
     * @return
     */
    @RequestMapping(value = "/getPopupAd", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getPopupAd(@RequestBody RequestBase request){
        String retStr = "";
        try {
            retStr = appModelService.getPopupAd(request);
        } catch (Exception e) {
            retStr = ResponseOptUtil.commonMsgError( ResponseOptUtil.RET_FAIL_MSG);
            e.printStackTrace();
        }
        return retStr;

    }



}
